import java.util.Scanner;

public class MenuSelection {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int choice = 0;
        boolean validInput = false;

        while (!validInput) {
            System.out.println("请选择以下选项：");
            System.out.println("1：登陆");
            System.out.println("2：注册");
            System.out.println("3：联系客服");

            try {
                choice = Integer.parseInt(scanner.nextLine());
                switch (choice) {
                    case 1:
                        System.out.println("您选择了登陆。");
                        validInput = true;
                        break;
                    case 2:
                        System.out.println("您选择了注册。");
                        validInput = true;
                        break;
                    case 3:
                        System.out.println("您选择了联系客服。");
                        validInput = true;
                        break;
                    default:
                        System.out.println("输入的选项不存在，请重新输入。");
                }
            } catch (NumberFormatException e) {
                System.out.println("输入错误，请输入一个有效的数字。");
            }
        }

        scanner.close();
    }
}
